#include <iostream>
#include "search_algo.h"

void test() {
    Search search_algo;
    std::vector<int> nums = {1,2,3,4,15,15,15,26,47,54,63,86,100};
    int target = 44;
    int target_id = search_algo.binarySearch(nums,target);
    int target_id2 = search_algo.binarySearchLCRO(nums,target);
    int target_id3 = search_algo.binarySearchInsertionSimple(nums,target);
    int target_id4 = search_algo.binarySearchInsertion(nums,target);
    int target_id5 = search_algo.binarySearchLeftEdge(nums,target);
    int target_id6 = search_algo.binarySearchRightEdge(nums,target);
    std::cout << "target_id: " << target_id << std::endl;
    std::cout << "target_id2: " << target_id2 << std::endl;
    std::cout << "target_id3: " << target_id3 << std::endl;
    std::cout << "target_id4: " << target_id4 << std::endl;
    std::cout << "target_id5: " << target_id5 << std::endl;
    std::cout << "target_id6: " << target_id6 << std::endl;

    std::vector<int> target_ids = {};
    target_ids = search_algo.twoSumHashTable(nums,target);
    if (target_ids.size() != 0) {
    for(int i = 0;i < target_ids.size();i++) {
        std::cout << target_ids.at(i) << " ";
    }
    std::cout << "\n";
    }
    else {
        std::cout << "未找到符合两数之和的元素" << std::endl;
    }
}
int main()
{
    test();
    return 0;
}
